package com.zues.rabbit_self_test.utils;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.rabbitmq.client.ConnectionFactory;

/**
 * @ClassName RabbitMqUtils
 * @Description TODO
 * @Author zeus
 * @Date 6/12/2025 2:51 下午
 * @Version 1.0
 **/
public class RabbitMqUtils {


    /**
     * 得到一个连接的 channel
     * @return Channel
     * @throws Exception 异常
     */
    public static Channel getChannel() throws Exception{
        // 创建一个连接工厂
        ConnectionFactory factory = new ConnectionFactory();
        factory.setHost("192.168.116.129");
        factory.setUsername("guest");
        factory.setPassword("guest");
        Connection connection = factory.newConnection();
        return connection.createChannel();
    }

}
